package com.example.demo.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.impl.addresslmpl;

@RestController
@RequestMapping("/address")
@CrossOrigin(origins="http://localhost:8081")
public class addresscontroller {
    @Autowired(required=false)
    addresslmpl addressmapper;

    @GetMapping("/addaddress")
    public Boolean addaddress(String username,String name,String phone,String address)
    {
        addressmapper.addaddress(username, name, phone, address);
        return true;

    }


    @GetMapping("/findaddress")
    public Object addaddress(String username)
    {
        return addressmapper.find_addaddress(username);
    }

    @GetMapping("/delete")
    public Boolean addaddress(Integer id)
    {
        addressmapper.delete_addaddress(id);
        return true;
    }
}